package reflect;

import java.lang.reflect.Method;

public class ReflectDemo8 {
    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException {
        Class cla = Class.forName("reflect.Person");
        Object obj = cla.newInstance();
        Method method = cla.getMethod("sayHello");
        if (method.isAnnotationPresent(AutoRunMethod.class)){

            AutoRunMethod arm = method.getAnnotation(AutoRunMethod.class);
            int a = arm.value();
            System.out.println("参数为：" + a);
        }

    }
}
